home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
msn
/
Msnifier.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
76 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
from __future__ import with_statement
__author__ = 'dotSyntax'
import itertools
from time import sleep
from types import GeneratorType as generator
import logging
from util import PriorityQueue, TimeOut, default_timer
log = logging.getLogger('msn.msnifier')
class Msnifier(TimeOut):
def __init__(self, socket):
TimeOut.__init__(self)
self.to_send = None
self.socket = socket
self.queue = PriorityQueue()
def send_pkt(self, pkt, priority = 5):
self._cv.__enter__()
try:
self.queue.append(pkt, priority)
finally:
pass
def compute_timeout(self):
if self._finished:
self._last_computed = -1
else:
self._last_computed = 5
pkt = self.next_pkt()
if pkt is not None:
self._last_computed = self.socket.time_to_send(str(pkt))
self.queue.append(iter([
pkt]), priority = 1)
return self._last_computed
def process(self):
pkt = self.next_pkt()
if pkt is not None:
self.socket._send(str(pkt))
def next_pkt(self):
pkt = None
q = self.queue
while pkt is None and q:
try:
x = q.peek()
try:
pkt = x.next()
except AttributeError:
pkt = q.next()
continue
except (GeneratorExit, StopIteration, ValueError):
q.next()
continue
None<EXCEPTION MATCH>(GeneratorExit, StopIteration, ValueError)
return pkt